package com.study.transaction.order;

import org.springframework.amqp.core.Queue;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication
@EnableScheduling
public class OrderServiceApplication {

	public static void main(String[] args) {
		new SpringApplicationBuilder(OrderServiceApplication.class).web(WebApplicationType.SERVLET).run(args);
	}


	/**
	 * 在Rabbitmq里面创建一个Queue（类似数据库的表table）
	 * @return
	 */
	@Bean
	public Queue createRabbitmqQueue() {
		//spring自动在rabbitmq服务器自动创建
		return new Queue("orderQueue");
	}
}
